﻿using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	// Token: 0x02000FBD RID: 4029
	internal sealed class XBillboardComponent : XComponent
	{
		// Token: 0x170036A6 RID: 13990
		// (get) Token: 0x0600D147 RID: 53575 RVA: 0x00306F6C File Offset: 0x0030516C
		public override uint ID
		{
			get
			{
				return XBillboardComponent.uuID;
			}
		}

		// Token: 0x0600D148 RID: 53576 RVA: 0x00306F84 File Offset: 0x00305184
		public XBillboardComponent()
		{
			this._resetOnHitCb = new XTimerMgr.ElapsedEventHandler(this.ResetOnHit);
		}

		// Token: 0x0600D149 RID: 53577 RVA: 0x00307090 File Offset: 0x00305290
		public override void OnAttachToHost(XObject host)
		{
			base.OnAttachToHost(host);
			GameObject billboard = XBillBoardDocument.GetBillboard(this._entity.EngineObject.Position, this._entity.EngineObject.Rotation);
			bool flag = billboard != null;
			if (flag)
			{
				billboard.name = this._entity.ID.ToString() + "_billb";
				this._billboard = billboard.transform;
			}
			this._uiDummy = (this._billboard.GetComponent("UIDummy") as IUIDummy);
			bool isNpc = this._entity.IsNpc;
			if (isNpc)
			{
				IUIRect parent = XSingleton<XGameUI>.singleton.NpcHpbarRoot.UIComponent as IUIRect;
				XSingleton<UiUtility>.singleton.AddChild(parent, billboard, XSingleton<XGameUI>.singleton.NpcHpbarRoot);
			}
			else
			{
				IUIRect parent2 = XSingleton<XGameUI>.singleton.HpbarRoot.UIComponent as IUIRect;
				XSingleton<UiUtility>.singleton.AddChild(parent2, billboard, XSingleton<XGameUI>.singleton.HpbarRoot);
			}
			bool flag2 = XBillboardComponent.fscale == null;
			if (flag2)
			{
				XSingleton<XGlobalConfig>.singleton.GetFloatList("BillboardScaleConfig", ref XBillboardComponent.fscale);
			}
		}

		// Token: 0x0600D14A RID: 53578 RVA: 0x003071BC File Offset: 0x003053BC
		protected override void EventSubscribe()
		{
			base.RegisterEvent(XEventDefine.XEvent_HUDAdd, new XComponent.XEventHandler(this.OnHit));
			base.RegisterEvent(XEventDefine.XEvent_GuildInfoChange, new XComponent.XEventHandler(this.OnGuildInfoChange));
			base.RegisterEvent(XEventDefine.XEvent_DesignationInfoChange, new XComponent.XEventHandler(this.OnDesignationInfoChange));
			base.RegisterEvent(XEventDefine.XEvent_TitleChange, new XComponent.XEventHandler(this.OnTitleNameChange));
			base.RegisterEvent(XEventDefine.XEvent_BillboardHide, new XComponent.XEventHandler(this.OnHideSelf));
			base.RegisterEvent(XEventDefine.XEvent_BillboardShowCtrl, new XComponent.XEventHandler(this.OnShowCtrl));
			base.RegisterEvent(XEventDefine.XEvent_FightGroupChanged, new XComponent.XEventHandler(this.OnFightGroupChange));
			base.RegisterEvent(XEventDefine.XEvent_BigMeleePointChange, new XComponent.XEventHandler(this.OnBigMeleePointChange));
			base.RegisterEvent(XEventDefine.XEvent_BigMeleeEnemyChange, new XComponent.XEventHandler(this.OnBigMeleeEnemyChange));
		}

		// Token: 0x0600D14B RID: 53579 RVA: 0x00307298 File Offset: 0x00305498
		private bool OnHit(XEventArgs e)
		{
			this._bHitFlag = true;
			bool flag = this._timer > 0U;
			if (flag)
			{
				XSingleton<XTimerMgr>.singleton.KillTimer(this._timer);
			}
			this._timer = XSingleton<XTimerMgr>.singleton.SetTimer(2f, this._resetOnHitCb, null);
			return true;
		}

		// Token: 0x0600D14C RID: 53580 RVA: 0x003072EC File Offset: 0x003054EC
		private void ResetOnHit(object o)
		{
			this._bHitFlag = false;
		}

		// Token: 0x0600D14D RID: 53581 RVA: 0x003072F8 File Offset: 0x003054F8
		private bool OnFightGroupChange(XEventArgs e)
		{
			this.Refresh();
			return true;
		}

		// Token: 0x0600D14E RID: 53582 RVA: 0x00307312 File Offset: 0x00305512
		public void Refresh()
		{
			this.Attached();
		}

		// Token: 0x170036A7 RID: 13991
		// (get) Token: 0x0600D14F RID: 53583 RVA: 0x0030731C File Offset: 0x0030551C
		public float viewDistance
		{
			get
			{
				return this._viewDistance;
			}
		}

		// Token: 0x170036A8 RID: 13992
		// (get) Token: 0x0600D150 RID: 53584 RVA: 0x00307334 File Offset: 0x00305534
		public bool alwaysShow
		{
			get
			{
				return this._alwaysShow;
			}
		}

		// Token: 0x0600D151 RID: 53585 RVA: 0x0030734C File Offset: 0x0030554C
		public override void Attached()
		{
			base.Attached();
			this._inited = true;
			this._compRef = (this._billboard.GetComponent("XUIBillBoardCompRef") as IXUIBillBoardCompRef);
			this._bloodBar = this._compRef.BloodBar;
			this._indureBar = this._compRef.IndureBar;
			this._desiSpcSymbol = this._compRef.DesiSpecLabelSymbol;
			this._guildSpcSymbol = this._compRef.GuildSpecLabelSymbol;
			this._nameSpcSymbol = this._compRef.NameSpecLabelSymbol;
			this._active = this._billboard.gameObject.activeInHierarchy;
			bool flag = !this._active;
			if (!flag)
			{
				this._desiSpcSymbol.SetVisible(false);
				this.UpdateDesignationPos();
				XEntityStatistics.RowData byID = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._entity.TypeID);
				this._alwaysShow = (!this._entity.IsRole && byID != null && byID.AlwaysHpBar);
				bool flag2 = XSingleton<XSceneMgr>.singleton.IsPVEScene();
				if (flag2)
				{
					bool bSpectator = XSingleton<XScene>.singleton.bSpectator;
					if (bSpectator)
					{
						bool flag3 = XSingleton<XEntityMgr>.singleton.Player == null || XSingleton<XEntityMgr>.singleton.Player.WatchTo == null;
						if (flag3)
						{
							this._inited = false;
							return;
						}
					}
					bool flag4 = XSingleton<XScene>.singleton.bSpectator ? XSingleton<XEntityMgr>.singleton.IsOpponent(XSingleton<XEntityMgr>.singleton.Player.WatchTo, this._entity) : XSingleton<XEntityMgr>.singleton.IsOpponent(XSingleton<XEntityMgr>.singleton.Player, this._entity);
					this._viewDistance = XSingleton<XProfessionSkillMgr>.singleton.GetVisibleDistance(0U);
					bool isPlayer = this._entity.IsPlayer;
					if (isPlayer)
					{
						this.SetupInfo(false, false, this._alwaysShow, false, "", XBillboardComponent.nullColor, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
						this.f = XBillboardComponent.fscale[0];
					}
					else
					{
						bool flag5 = flag4;
						if (flag5)
						{
							bool isBoss = this._entity.IsBoss;
							if (isBoss)
							{
								this._viewDistance = 30f;
								this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_red, XBillboardComponent.nullColor, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
								XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
								{
									this.GetStr(XBillboardComponent.BOSS_ICON_ATLAS, XBillboardComponent.BOSS_ICON_SPRITE, false),
									this.GetStr("", this._nameColor + this._entity.Attributes.Name, false),
									this.GetStr(XBillboardComponent.BOSS_ICON_ATLAS, XBillboardComponent.BOSS_ICON_SPRITE, false)
								});
								this.f = XBillboardComponent.fscale[1];
							}
							else
							{
								bool isElite = this._entity.IsElite;
								if (isElite)
								{
									this.SetupInfo(true, false, true, true, XBillboardComponent.billboardString_gold, XBillboardComponent.nullColor, XBillboardComponent.billboard_red, XBillboardComponent.billboard_yellow);
									XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
									{
										this.GetStr(XBillboardComponent.ELITE_ICON_ATLAS, XBillboardComponent.ELITE_ICON_SPRITE, false),
										this.GetStr("", this._nameColor + this._entity.Attributes.Name, false),
										this.GetStr(XBillboardComponent.ELITE_ICON_ATLAS, XBillboardComponent.ELITE_ICON_SPRITE, false)
									});
									this._alwaysShow = true;
									this._bHpbarVisible = true;
									this._bIndurebarVisible = true;
									this._secondbar_usage = BillboardUsage.Indure;
									this.f = XBillboardComponent.fscale[2];
								}
								else
								{
									bool isOpposer = this._entity.IsOpposer;
									if (isOpposer)
									{
										bool flag6 = this._entity.Prefab == "Empty_monster_trap";
										if (flag6)
										{
											this.SetupInfo(false, false, false, false, "", XBillboardComponent.nullColor, XBillboardComponent.billboard_red, XBillboardComponent.nullColor);
											this._bHpbarVisible = false;
										}
										else
										{
											this.SetupInfo(false, false, true, false, "", XBillboardComponent.nullColor, XBillboardComponent.billboard_red, XBillboardComponent.nullColor);
											this._bHpbarVisible = true;
										}
										this.f = XBillboardComponent.fscale[3];
									}
									else
									{
										bool isRole = this._entity.IsRole;
										if (isRole)
										{
											this.SetupInfo(true, true, true, false, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.nullColor);
											this._alwaysShow = true;
											this._bHpbarVisible = true;
											this._bIndurebarVisible = false;
											this.SetupGuildInfo();
											this.f = XBillboardComponent.fscale[4];
										}
									}
								}
							}
						}
						else
						{
							this._viewDistance = 10f;
							bool flag7 = !this._entity.IsPuppet && !this._entity.IsSubstance;
							if (flag7)
							{
								XEntityStatistics.RowData byID2 = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._entity.TypeID);
								bool flag8 = !this._entity.IsRole && byID2 != null;
								if (flag8)
								{
									this.SetupInfo(!byID2.HideName, false, this._alwaysShow, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_ally_hp, XBillboardComponent.nullColor);
								}
								else
								{
									this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_ally_hp, XBillboardComponent.nullColor);
								}
								this._bHpbarVisible = this._alwaysShow;
								this.SetupGuildInfo();
								bool isRole2 = this._entity.IsRole;
								if (isRole2)
								{
									this.f = XBillboardComponent.fscale[4];
								}
								else
								{
									this.f = XBillboardComponent.fscale[6];
								}
							}
						}
					}
				}
				else
				{
					bool flag9 = XSingleton<XSceneMgr>.singleton.IsPVPScene();
					if (flag9)
					{
						this._viewDistance = 10f;
						this._bHpbarVisible = true;
						this._bIndurebarVisible = true;
						bool isPlayer2 = this._entity.IsPlayer;
						if (isPlayer2)
						{
							this.f = XBillboardComponent.fscale[0];
						}
						else
						{
							this.f = XBillboardComponent.fscale[4];
						}
						bool flag10 = (this._entity.IsRole || (this._entity.Attributes != null && this._entity.Attributes.HostID != 0UL)) && XSingleton<XScene>.singleton.bSpectator;
						if (flag10)
						{
							bool isPlayer3 = this._entity.IsPlayer;
							if (isPlayer3)
							{
								this._bHpbarVisible = false;
								this._bIndurebarVisible = false;
								this.SetupInfo(false, false, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
							}
							else
							{
								bool isRole3 = this._entity.IsRole;
								if (isRole3)
								{
									XSpectateSceneDocument specificDocument = XDocuments.GetSpecificDocument<XSpectateSceneDocument>(XSpectateSceneDocument.uuID);
									bool flag12;
									bool flag11 = !specificDocument.TryGetEntityIsBlueTeam(this._entity, out flag12);
									if (flag11)
									{
										this._bHpbarVisible = false;
										this._bIndurebarVisible = false;
										this.SetupInfo(false, false, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
									}
									else
									{
										bool flag13 = flag12;
										if (flag13)
										{
											this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
										}
										else
										{
											this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_green, XBillboardComponent.billboard_red, XBillboardComponent.billboard_blue);
										}
										this._alwaysShow = true;
										this._secondbar_usage = BillboardUsage.MP;
										this.SetupGuildInfo();
									}
									XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes;
									this.DealWithTitleNameChange(0U, xroleAttributes.MilitaryRank);
								}
								else
								{
									bool flag14 = this._entity.Attributes != null && this._entity.Attributes.HostID > 0UL;
									if (flag14)
									{
										XSpectateSceneDocument specificDocument2 = XDocuments.GetSpecificDocument<XSpectateSceneDocument>(XSpectateSceneDocument.uuID);
										bool flag16;
										bool flag15 = !specificDocument2.TryGetSummonedIsBlueTeam(this._entity, out flag16);
										if (flag15)
										{
											this._bHpbarVisible = false;
											this._bIndurebarVisible = false;
											this.SetupInfo(false, false, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
										}
										else
										{
											string nameColor = flag16 ? XBillboardComponent.billboardString_blue : XBillboardComponent.billboardString_red;
											Color bloodColor = flag16 ? XBillboardComponent.billboard_green : XBillboardComponent.billboard_red;
											this._bIndurebarVisible = false;
											XEntityStatistics.RowData byID3 = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._entity.TypeID);
											this.SetupInfo(byID3 == null || !byID3.HideName, false, true, false, nameColor, XBillboardComponent.billboard_green, bloodColor, XBillboardComponent.billboard_blue);
											this._bHpbarVisible = this._alwaysShow;
											this._secondbar_usage = BillboardUsage.MP;
										}
									}
								}
							}
						}
						else
						{
							bool flag17 = !this._entity.IsPlayer && XSingleton<XEntityMgr>.singleton.IsOpponent(XSingleton<XEntityMgr>.singleton.Player, this._entity);
							if (flag17)
							{
								bool flag18 = !this._entity.IsRole;
								if (flag18)
								{
									this._bIndurebarVisible = false;
									XEntityStatistics.RowData byID4 = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._entity.TypeID);
									bool flag19 = byID4 != null;
									if (flag19)
									{
										this.SetupInfo(!byID4.HideName, false, true, false, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.nullColor);
									}
									else
									{
										this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_blue);
									}
									this.SetupGuildInfo();
									this._bHpbarVisible = this._alwaysShow;
								}
								else
								{
									this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_blue);
									this.SetupGuildInfo();
									XRoleAttributes xroleAttributes2 = this._entity.Attributes as XRoleAttributes;
									this.DealWithTitleNameChange(0U, xroleAttributes2.MilitaryRank);
								}
								this._secondbar_usage = BillboardUsage.MP;
							}
							else
							{
								bool flag20 = !this._entity.IsPlayer && !this._entity.IsRole;
								if (flag20)
								{
									this._bIndurebarVisible = false;
									XEntityStatistics.RowData byID5 = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._entity.TypeID);
									bool flag21 = byID5 != null;
									if (flag21)
									{
										this.SetupInfo(!byID5.HideName, false, true, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.nullColor);
									}
									else
									{
										this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
									}
									this.SetupGuildInfo();
									this._bHpbarVisible = this._alwaysShow;
								}
								else
								{
									bool flag22 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_BIGMELEE_FIGHT;
									if (flag22)
									{
										this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_white, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
									}
									else
									{
										this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
									}
									this.SetupGuildInfo();
									bool isPlayer4 = this._entity.IsPlayer;
									if (isPlayer4)
									{
										this.DealWithTitleNameChange(XSingleton<XAttributeMgr>.singleton.XPlayerData.TitleID, XSingleton<XAttributeMgr>.singleton.XPlayerData.MilitaryRank);
									}
									else
									{
										XRoleAttributes xroleAttributes3 = this._entity.Attributes as XRoleAttributes;
										this.DealWithTitleNameChange(0U, xroleAttributes3.MilitaryRank);
									}
								}
								this._secondbar_usage = BillboardUsage.MP;
							}
						}
					}
					else
					{
						bool isPlayer5 = this._entity.IsPlayer;
						if (isPlayer5)
						{
							this.SetupInfo(true, true, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_sgreen, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
							this.SetupGuildInfo();
							XDesignationDocument specificDocument3 = XDocuments.GetSpecificDocument<XDesignationDocument>(XDesignationDocument.uuID);
							this.DealWithDesignation(specificDocument3.CoverDesignationID, specificDocument3.SpecialDesignation);
							this.DealWithTitleNameChange(XSingleton<XAttributeMgr>.singleton.XPlayerData.TitleID, XSingleton<XAttributeMgr>.singleton.XPlayerData.MilitaryRank);
							this.f = XBillboardComponent.fscale[0];
						}
						else
						{
							bool flag23 = XSingleton<XEntityMgr>.singleton.IsAlly(this._entity);
							if (flag23)
							{
								this._viewDistance = Mathf.Sqrt(XQualitySetting._FadeDistance);
								bool isRole4 = this._entity.IsRole;
								if (isRole4)
								{
									this.SetupInfo(true, true, false, false, XBillboardComponent.billboardString_white, XBillboardComponent.billboard_sgreen, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
									this.SetupGuildInfo();
									XRoleAttributes xroleAttributes4 = this._entity.Attributes as XRoleAttributes;
									this.DealWithDesignation(xroleAttributes4.DesignationID, xroleAttributes4.SpecialDesignation);
									this.DealWithTitleNameChange(this._entity.Attributes.TitleID, xroleAttributes4.MilitaryRank);
									this.f = XBillboardComponent.fscale[4];
								}
								else
								{
									this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_white, XBillboardComponent.billboard_white, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
									this.f = XBillboardComponent.fscale[6];
								}
							}
							else
							{
								bool isNpc = this._entity.IsNpc;
								if (isNpc)
								{
									XNpcInfo.RowData byNPCID = XSingleton<XEntityMgr>.singleton.NpcInfo.GetByNPCID(this._entity.TypeID);
									bool flag24 = byNPCID.NPCType == 2U;
									if (flag24)
									{
										this._nameSpcSymbol.SetVisible(false);
									}
									else
									{
										XNPCFavorDocument specificDocument4 = XDocuments.GetSpecificDocument<XNPCFavorDocument>(XNPCFavorDocument.uuID);
										bool flag25 = specificDocument4.IsShowNPCFavoritePlayer(this._entity.TypeID);
										if (flag25)
										{
											this.SetupInfo(true, true, this._alwaysShow, false, XBillboardComponent.billboardString_syellow, XBillboardComponent.billboard_favor, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
											this.SetupNpcFavorInfo();
										}
										else
										{
											this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_syellow, XBillboardComponent.nullColor, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
										}
										this._viewDistance = 10f;
										this.f = XBillboardComponent.fscale[5];
									}
								}
							}
						}
					}
				}
				this.DrawStr(this._nameSpcSymbol);
				bool isPlayer6 = this._entity.IsPlayer;
				if (isPlayer6)
				{
					this.SetBillBoardDepth(true, 0f);
				}
				else
				{
					this.KeepAllDepth();
				}
				this._billboard.transform.localScale = new Vector3(XBillboardComponent.k * this.f, XBillboardComponent.k * this.f, XBillboardComponent.k * this.f);
				this._uiDummy.alpha = 0f;
			}
		}

		// Token: 0x0600D152 RID: 53586 RVA: 0x00308154 File Offset: 0x00306354
		private void SetupNpcFavorInfo()
		{
			bool flag = XSingleton<XSceneMgr>.singleton.IsPVEScene() || XSingleton<XSceneMgr>.singleton.IsPVPScene() || !this._entity.IsNpc;
			if (flag)
			{
				this._guildSpcSymbol.SetVisible(false);
			}
			else
			{
				XNPCFavorDocument specificDocument = XDocuments.GetSpecificDocument<XNPCFavorDocument>(XNPCFavorDocument.uuID);
				string favoritePlayerName = specificDocument.GetFavoritePlayerName(this._entity.TypeID);
				XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
				{
					this.GetStr(XBillboardComponent.GUILD_ICON_ATLAS, XBillboardComponent.NPCFAVOR_ICON_SPRITE, false),
					this.GetStr("", string.Format("{0}", favoritePlayerName), false)
				});
				this.DrawStr(this._guildSpcSymbol);
				XSingleton<UiUtility>.singleton.ComSpriteStr.Clear();
				XSingleton<UiUtility>.singleton.ComSpriteStr.Add(this.GetStr("", this._nameColor + this._entity.Attributes.Name, false));
			}
		}

		// Token: 0x0600D153 RID: 53587 RVA: 0x00308254 File Offset: 0x00306454
		private void SetBillBoardSameByMaster()
		{
			bool flag = XEntity.ValideEntity(this._entity.MobbedBy);
			if (flag)
			{
				XBillboardComponent billBoard = this._entity.MobbedBy.BillBoard;
				this._bHpbarVisible = billBoard._bHpbarVisible;
				this._bIndurebarVisible = billBoard._bIndurebarVisible;
				this._indureBar.SetForegroundColor(XBillboardComponent.billboard_blue);
				this._desiSpcSymbol.Copy(billBoard._desiSpcSymbol);
				this._guildSpcSymbol.Copy(billBoard._guildSpcSymbol);
				this._nameSpcSymbol.Copy(billBoard._nameSpcSymbol);
			}
		}

		// Token: 0x0600D154 RID: 53588 RVA: 0x003082E8 File Offset: 0x003064E8
		private bool OnGuildInfoChange(XEventArgs e)
		{
			this.SetupGuildInfo();
			this.UpdateDesignationPos();
			this.KeepAllDepth();
			return true;
		}

		// Token: 0x0600D155 RID: 53589 RVA: 0x00308310 File Offset: 0x00306510
		private void UpdateDesignationPos()
		{
			bool isPlayer = this._entity.IsPlayer;
			if (isPlayer)
			{
				XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
				bool flag = !specificDocument.bInGuild;
				if (flag)
				{
					this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 65f, 0f);
				}
				else
				{
					this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 96f, 0f);
				}
			}
			else
			{
				bool isRole = this._entity.IsRole;
				if (isRole)
				{
					XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes;
					bool flag2 = xroleAttributes != null;
					if (flag2)
					{
						bool flag3 = string.IsNullOrEmpty(xroleAttributes.GuildName) && XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_BIGMELEE_FIGHT;
						if (flag3)
						{
							this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 65f, 0f);
						}
						else
						{
							this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 96f, 0f);
						}
					}
				}
			}
		}

		// Token: 0x170036A9 RID: 13993
		// (get) Token: 0x0600D156 RID: 53590 RVA: 0x0030845C File Offset: 0x0030665C
		private bool isTerritoryFight
		{
			get
			{
				return XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT;
			}
		}

		// Token: 0x0600D157 RID: 53591 RVA: 0x00308490 File Offset: 0x00306690
		public void OnFightDesignationInfoChange(uint id)
		{
			bool isTerritoryFight = this.isTerritoryFight;
			if (isTerritoryFight)
			{
				bool isRole = this._entity.IsRole;
				if (isRole)
				{
					XGuildTerritoryDocument specificDocument = XDocuments.GetSpecificDocument<XGuildTerritoryDocument>(XGuildTerritoryDocument.uuID);
					FightDesignation.RowData designation = specificDocument.GetDesignation(id);
					this._desiSpcSymbol.SetVisible(id != 0U && designation != null);
					bool flag = id != 0U && designation != null;
					if (flag)
					{
						bool flag2 = string.IsNullOrEmpty(designation.Effect);
						if (flag2)
						{
							this._desiSpcSymbol.Board.SetVisible(true);
							XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
							{
								this.GetStr("", designation.Color + designation.Designation, false)
							});
							this.DrawStr(this._desiSpcSymbol);
						}
						else
						{
							this._desiSpcSymbol.Board.SetVisible(false);
							XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
							{
								this.GetStr(XBillboardComponent.DESIGNATION_ATLAS, designation.Effect, false)
							});
							this.DrawStr(this._desiSpcSymbol);
						}
					}
				}
			}
		}

		// Token: 0x0600D158 RID: 53592 RVA: 0x003085AC File Offset: 0x003067AC
		private void DealWithDesignation(uint id, string specDesi)
		{
			bool isTerritoryFight = this.isTerritoryFight;
			if (!isTerritoryFight)
			{
				XDesignationDocument specificDocument = XDocuments.GetSpecificDocument<XDesignationDocument>(XDesignationDocument.uuID);
				DesignationTable.RowData byID = specificDocument._DesignationTable.GetByID((int)id);
				bool flag = byID == null;
				if (flag)
				{
					id = 0U;
				}
				this._desiSpcSymbol.SetVisible(id > 0U);
				bool flag2 = id > 0U;
				if (flag2)
				{
					bool flag3 = byID.Effect == "";
					if (flag3)
					{
						this._desiSpcSymbol.Board.SetVisible(true);
						bool special = byID.Special;
						if (special)
						{
							XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
							{
								this.GetStr("", byID.Color + specDesi, false)
							});
						}
						else
						{
							XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
							{
								this.GetStr("", byID.Color + byID.Designation, false)
							});
						}
						this.DrawStr(this._desiSpcSymbol);
					}
					else
					{
						this._desiSpcSymbol.Board.SetVisible(false);
						XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
						{
							this.GetStr(byID.Atlas, byID.Effect, false)
						});
						this.DrawStr(this._desiSpcSymbol);
					}
				}
			}
		}

		// Token: 0x0600D159 RID: 53593 RVA: 0x003086FC File Offset: 0x003068FC
		public bool OnDesignationInfoChange(XEventArgs e = null)
		{
			bool flag = XSingleton<XSceneMgr>.singleton.IsPVEScene() || XSingleton<XSceneMgr>.singleton.IsPVPScene();
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				bool isPlayer = this._entity.IsPlayer;
				if (isPlayer)
				{
					XDesignationDocument specificDocument = XDocuments.GetSpecificDocument<XDesignationDocument>(XDesignationDocument.uuID);
					this.DealWithDesignation(specificDocument.CoverDesignationID, specificDocument.SpecialDesignation);
				}
				else
				{
					bool isRole = this._entity.IsRole;
					if (isRole)
					{
						XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes;
						this.DealWithDesignation(xroleAttributes.DesignationID, xroleAttributes.SpecialDesignation);
					}
				}
				this.KeepAllDepth();
				result = true;
			}
			return result;
		}

		// Token: 0x0600D15A RID: 53594 RVA: 0x003087A4 File Offset: 0x003069A4
		private void DealWithTitleNameChange(uint titleId, uint level)
		{
			XSingleton<UiUtility>.singleton.ComSpriteStr.Clear();
			bool flag = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.Hall || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_PVP || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_HEROBATTLE || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_GPR || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT;
			if (flag)
			{
				MilitaryRankByExploit.RowData byMilitaryRank = XMilitaryRankDocument._militaryReader.GetByMilitaryRank(level);
				bool flag2 = byMilitaryRank != null;
				if (flag2)
				{
					XSingleton<UiUtility>.singleton.ComSpriteStr.Add(this.GetStr(XBillboardComponent.MILITARY_ATLAS, byMilitaryRank.Icon, false));
				}
			}
			bool flag3 = !XSingleton<XSceneMgr>.singleton.IsPVPScene();
			if (flag3)
			{
				bool flag4 = titleId > 0U;
				if (flag4)
				{
					TitleTable.RowData title = XTitleDocument.GetTitle(titleId);
					bool flag5 = title != null;
					if (flag5)
					{
						XSingleton<UiUtility>.singleton.ComSpriteStr.Add(this.GetStr(title.RankAtlas, title.RankIcon, true));
					}
				}
			}
			XSingleton<UiUtility>.singleton.ComSpriteStr.Add(this.GetStr("", this._nameColor + this._entity.Attributes.Name, false));
		}

		// Token: 0x0600D15B RID: 53595 RVA: 0x003088EC File Offset: 0x00306AEC
		public bool OnTitleNameChange(XEventArgs e = null)
		{
			bool flag = XSingleton<XSceneMgr>.singleton.IsPVEScene();
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				bool isPlayer = this._entity.IsPlayer;
				if (isPlayer)
				{
					this.DealWithTitleNameChange(XSingleton<XAttributeMgr>.singleton.XPlayerData.TitleID, XSingleton<XAttributeMgr>.singleton.XPlayerData.MilitaryRank);
				}
				else
				{
					bool isRole = this._entity.IsRole;
					if (isRole)
					{
						XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes;
						this.DealWithTitleNameChange(this._entity.Attributes.TitleID, xroleAttributes.MilitaryRank);
					}
				}
				this.DrawStr(this._nameSpcSymbol);
				this.KeepAllDepth();
				result = true;
			}
			return result;
		}

		// Token: 0x0600D15C RID: 53596 RVA: 0x003089A1 File Offset: 0x00306BA1
		public void OnGuildCollectNpcNameChange(string name)
		{
			XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
			{
				this.GetStr("", this._nameColor + name, false)
			});
			this.DrawStr(this._nameSpcSymbol);
		}

		// Token: 0x0600D15D RID: 53597 RVA: 0x003089E0 File Offset: 0x00306BE0
		private void SetupInfo(bool nameState, bool guildState, bool bloodBarState, bool indureBarState, string nameColor, Color guildColor, Color bloodColor, Color indureColor)
		{
			if (bloodBarState)
			{
				this._bloodBar.gameObject.SetActive(true);
				this._bloodBar.SetForegroundColor(bloodColor);
			}
			else
			{
				this._bloodBar.gameObject.SetActive(false);
			}
			if (nameState)
			{
				this._nameSpcSymbol.SetVisible(true);
				XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
				{
					this.GetStr("", nameColor + this._entity.Attributes.Name, false)
				});
				this._nameColor = nameColor;
			}
			else
			{
				this._nameSpcSymbol.SetVisible(false);
			}
			if (guildState)
			{
				this._guildSpcSymbol.SetVisible(true);
				this._guildSpcSymbol.SetColor(guildColor);
			}
			else
			{
				this._guildSpcSymbol.SetVisible(false);
			}
			if (indureBarState)
			{
				this._indureBar.gameObject.SetActive(true);
				this._indureBar.SetForegroundColor(indureColor);
			}
			else
			{
				this._indureBar.gameObject.SetActive(false);
			}
		}

		// Token: 0x0600D15E RID: 53598 RVA: 0x00308AF8 File Offset: 0x00306CF8
		private void SetupGuildInfo()
		{
			bool flag = XSingleton<XSceneMgr>.singleton.IsPVEScene() || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_BATTLEFIELD_FIGHT || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_BIGMELEE_FIGHT;
			if (flag)
			{
				this._guildSpcSymbol.SetVisible(false);
			}
			else
			{
				bool isPlayer = this._entity.IsPlayer;
				if (isPlayer)
				{
					XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
					bool bInGuild = specificDocument.bInGuild;
					if (bInGuild)
					{
						this._guildSpcSymbol.SetVisible(true);
						XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
						{
							this.GetStr(XBillboardComponent.GUILD_ICON_ATLAS, XGuildDocument.GetPortraitName(specificDocument.BasicData.portraitIndex), false),
							this.GetStr("", string.Format("<{0}>", specificDocument.BasicData.guildName), false)
						});
						this.DrawStr(this._guildSpcSymbol);
					}
					else
					{
						this._guildSpcSymbol.SetVisible(false);
					}
				}
				else
				{
					bool isRole = this._entity.IsRole;
					if (isRole)
					{
						XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes;
						bool flag2 = xroleAttributes != null;
						if (flag2)
						{
							bool flag3 = string.IsNullOrEmpty(xroleAttributes.GuildName);
							if (flag3)
							{
								this._guildSpcSymbol.SetVisible(false);
							}
							else
							{
								this._guildSpcSymbol.SetVisible(true);
								XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
								{
									this.GetStr(XBillboardComponent.GUILD_ICON_ATLAS, XGuildDocument.GetPortraitName((int)xroleAttributes.GuildPortrait), false),
									this.GetStr("", string.Format("<{0}>", xroleAttributes.GuildName), false)
								});
								this.DrawStr(this._guildSpcSymbol);
							}
						}
					}
					else
					{
						bool isBoss = this._entity.IsBoss;
						if (isBoss)
						{
							this._guildSpcSymbol.SetVisible(false);
						}
					}
				}
			}
		}

		// Token: 0x0600D15F RID: 53599 RVA: 0x00308CDC File Offset: 0x00306EDC
		public override void OnDetachFromHost()
		{
			bool flag = this._timer > 0U;
			if (flag)
			{
				XSingleton<XTimerMgr>.singleton.KillTimer(this._timer);
			}
			bool flag2 = this._hideTimer > 0U;
			if (flag2)
			{
				XSingleton<XTimerMgr>.singleton.KillTimer(this._hideTimer);
			}
			this._alwaysHide = 0;
			this._alwaysShow = false;
			this.DestroyGameObjects();
			this._entity.BillBoard = null;
			base.OnDetachFromHost();
		}

		// Token: 0x0600D160 RID: 53600 RVA: 0x00308D50 File Offset: 0x00306F50
		private void DestroyGameObjects()
		{
			bool flag = this._billboard != null;
			if (flag)
			{
				this.ClearRef(this._desiSpcSymbol);
				this.ClearRef(this._guildSpcSymbol);
				this.ClearRef(this._nameSpcSymbol);
				XBillBoardDocument.ReturnBillboard(this._billboard.gameObject);
				this._billboard = null;
			}
		}

		// Token: 0x0600D161 RID: 53601 RVA: 0x00308DB0 File Offset: 0x00306FB0
		private void ClearRef(IXUISpecLabelSymbol symbol)
		{
			bool flag = symbol != null;
			if (flag)
			{
				for (int i = 0; i < symbol.SpriteList.Length; i++)
				{
					symbol.SpriteList[i].spriteName = "";
					symbol.SetSpriteVisibleFalse(i);
				}
			}
		}

		// Token: 0x0600D162 RID: 53602 RVA: 0x00308DFC File Offset: 0x00306FFC
		private bool OnHideSelf(XEventArgs e)
		{
			this._alwaysHide |= 1 << XFastEnumIntEqualityComparer<BillBoardHideType>.ToInt(BillBoardHideType.LevelScript);
			XBillboardHideEventArgs xbillboardHideEventArgs = e as XBillboardHideEventArgs;
			bool flag = this._hideTimer > 0U;
			if (flag)
			{
				XSingleton<XTimerMgr>.singleton.KillTimer(this._hideTimer);
			}
			this._hideTimer = XSingleton<XTimerMgr>.singleton.SetTimer(xbillboardHideEventArgs.hidetime, new XTimerMgr.ElapsedEventHandler(this.ReShow), null);
			return true;
		}

		// Token: 0x0600D163 RID: 53603 RVA: 0x00308E6F File Offset: 0x0030706F
		private void ReShow(object o)
		{
			this._alwaysHide &= ~(1 << XFastEnumIntEqualityComparer<BillBoardHideType>.ToInt(BillBoardHideType.LevelScript));
		}

		// Token: 0x0600D164 RID: 53604 RVA: 0x00308E8C File Offset: 0x0030708C
		private bool OnShowCtrl(XEventArgs e)
		{
			XBillboardShowCtrlEventArgs xbillboardShowCtrlEventArgs = e as XBillboardShowCtrlEventArgs;
			bool flag = xbillboardShowCtrlEventArgs.type == BillBoardHideType.Invalid;
			bool result;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("undefine billboard hide type. check code or contect pyc.", null, null, null, null, null);
				result = false;
			}
			else
			{
				bool show = xbillboardShowCtrlEventArgs.show;
				if (show)
				{
					this._alwaysHide &= ~(1 << XFastEnumIntEqualityComparer<BillBoardHideType>.ToInt(xbillboardShowCtrlEventArgs.type));
				}
				else
				{
					this._alwaysHide |= 1 << XFastEnumIntEqualityComparer<BillBoardHideType>.ToInt(xbillboardShowCtrlEventArgs.type);
				}
				result = true;
			}
			return result;
		}

		// Token: 0x0600D165 RID: 53605 RVA: 0x00308F18 File Offset: 0x00307118
		public override void PostUpdate(float fDeltaT)
		{
			XEntity xentity = this._host as XEntity;
			bool flag = xentity == null;
			if (!flag)
			{
				bool flag2 = !this._entity.IsDummy && !this._active && this._billboard != null;
				if (flag2)
				{
					bool activeInHierarchy = this._billboard.gameObject.activeInHierarchy;
					if (!activeInHierarchy)
					{
						return;
					}
					this.Attached();
				}
				bool flag3 = !this.InitByMaster && this._entity.MobbedBy != null;
				if (flag3)
				{
					this.InitByMaster = true;
					XOthersAttributes xothersAttributes = this._entity.Attributes as XOthersAttributes;
					bool sameBillBoardByMaster = xothersAttributes.SameBillBoardByMaster;
					if (sameBillBoardByMaster)
					{
						this.SetBillBoardSameByMaster();
					}
				}
				bool flag4 = !this.InitByMaster && this._entity.Attributes != null && this._entity.Attributes.HostID > 0UL;
				if (flag4)
				{
					this.InitByMaster = true;
					this.Refresh();
				}
				bool isDummy = this._entity.IsDummy;
				if (isDummy)
				{
					this.UpdateDummyBillboard();
				}
				else
				{
					bool flag5 = !XEntity.ValideEntity(xentity);
					if (flag5)
					{
						this._uiDummy.alpha = 0f;
					}
					else
					{
						bool flag6 = this._alwaysHide != 0;
						if (flag6)
						{
							this._uiDummy.alpha = 0f;
						}
						else
						{
							XPlayer player = XSingleton<XEntityMgr>.singleton.Player;
							bool flag7 = player == null || player.EngineObject == null;
							if (flag7)
							{
								this.DestroyGameObjects();
							}
							else
							{
								float num = Vector3.Distance(xentity.EngineObject.Position, player.EngineObject.Position);
								bool flag8 = num > this._viewDistance && !this._bHitFlag;
								if (flag8)
								{
									bool flag9 = this._billboard != null;
									if (flag9)
									{
										bool flag10 = !this._alwaysShow;
										if (flag10)
										{
											this._uiDummy.alpha = 0f;
											return;
										}
									}
								}
								bool flag11 = this._billboard != null;
								if (flag11)
								{
									this.UpdateHpBar();
								}
							}
						}
					}
				}
			}
		}

		// Token: 0x0600D166 RID: 53606 RVA: 0x00309140 File Offset: 0x00307340
		private void UpdateHpBar()
		{
			bool flag = !this._inited && XSingleton<XEntityMgr>.singleton.Player != null && XSingleton<XEntityMgr>.singleton.Player.WatchTo != null;
			if (flag)
			{
				this.Attached();
			}
			bool flag2 = this._uiDummy.alpha == 0f;
			if (flag2)
			{
				this._uiDummy.alpha = 1f;
			}
			float num = 0.2f;
			bool flag3 = !this._bloodBar.gameObject.activeSelf;
			if (flag3)
			{
				num -= 0.05f;
			}
			bool flag4 = !this._indureBar.gameObject.activeSelf;
			if (flag4)
			{
				num -= 0.05f;
			}
			this._heroHeight = ((this._entity.Transformer == null || !XEntity.ValideEntity(this._entity.Transformer)) ? this._entity.Height : this._entity.Transformer.Height);
			bool flag5 = this._entity.Attributes != null && this._entity.Attributes.Outlook != null && this._entity.Attributes.Outlook.state != null && this._entity.Attributes.Outlook.state.bMounted;
			float num2;
			if (flag5)
			{
				num2 = this._heroRidingHeight;
			}
			else
			{
				num2 = this._heroHeight;
			}
			Vector3 position = new Vector3(this._entity.EngineObject.Position.x, this._entity.EngineObject.Position.y + num2 + num, this._entity.EngineObject.Position.z);
			bool flag6 = this._entity.Prefab == "Empty_monster";
			if (flag6)
			{
				bool flag7 = this._entity.Skill.IsCasting() && this._entity.Skill.CurrentSkill.Target != null;
				if (flag7)
				{
					position = new Vector3(this._entity.Skill.CurrentSkill.Target.MoveObj.Position.x, this._entity.Skill.CurrentSkill.Target.MoveObj.Position.y + this._heroHeight + num, this._entity.Skill.CurrentSkill.Target.EngineObject.Position.z);
				}
			}
			this._billboard.position = position;
			this._billboard.rotation = XSingleton<XScene>.singleton.GameCamera.Rotaton;
			bool flag8 = XSingleton<XEntityMgr>.singleton.Player != null;
			if (flag8)
			{
				float num3 = XBillboardComponent.k;
				float num4 = 6.27f;
				float num5 = Vector3.Distance(XSingleton<XScene>.singleton.GameCamera.UnityCamera.transform.position, this._billboard.position);
				bool flag9 = !this._entity.IsPlayer;
				if (flag9)
				{
					bool flag10 = Time.frameCount % 15 == 0;
					if (flag10)
					{
						this.SetBillBoardDepth(false, num5);
					}
				}
				num3 = num3 * this.f * num5 / num4;
				this._billboard.localScale = new Vector3(num3, num3, num3);
			}
			this._bloodBar.gameObject.SetActive(this._bHpbarVisible && !this._entity.Present.IsShowUp);
			this._indureBar.gameObject.SetActive(this._bIndurebarVisible && !this._entity.Present.IsShowUp);
			bool flag11 = this._entity.Attributes != null;
			if (flag11)
			{
				bool onFreezeBuff = this._onFreezeBuff;
				if (onFreezeBuff)
				{
					bool flag12 = this._freezeBuffInfo == null;
					if (!flag12)
					{
						this._bloodBar.gameObject.SetActive(true);
						this._indureBar.gameObject.SetActive(false);
						this._bloodBar.value = (float)(this._freezeBuffInfo.HP / this._freezeBuffInfo.maxHP);
						Vector3 localScale = this._billboard.localScale;
						this._billboard.localScale = localScale * 1.4f;
						return;
					}
					this._onFreezeBuff = false;
				}
				double attr = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxHP_Total);
				double num6 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentHP_Basic);
				bool flag13 = num6 < 0.0;
				if (flag13)
				{
					num6 = 0.0;
				}
				this._bloodBar.value = (float)(num6 / attr);
				bool activeInHierarchy = this._indureBar.gameObject.activeInHierarchy;
				if (activeInHierarchy)
				{
					bool flag14 = this._secondbar_usage == BillboardUsage.Indure;
					if (flag14)
					{
						double attr2 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxSuperArmor_Total);
						double attr3 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentSuperArmor_Total);
						bool flag15 = attr2 > 0.0;
						if (flag15)
						{
							this._indureBar.gameObject.SetActive(true);
							bool flag16 = attr3 < attr2;
							if (flag16)
							{
								this._indureBar.value = (float)(attr3 / attr2);
							}
							else
							{
								this._indureBar.value = 1f;
							}
						}
						else
						{
							this._indureBar.gameObject.SetActive(false);
						}
					}
					else
					{
						bool flag17 = this._secondbar_usage == BillboardUsage.MP;
						if (flag17)
						{
							double attr4 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxMP_Total);
							double attr5 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentMP_Basic);
							bool flag18 = attr5 < attr4;
							if (flag18)
							{
								this._indureBar.value = (float)(attr5 / attr4);
							}
							else
							{
								this._indureBar.value = 1f;
							}
						}
					}
				}
			}
		}

		// Token: 0x0600D167 RID: 53607 RVA: 0x00309738 File Offset: 0x00307938
		public void SetFreezeBuffState(UIBuffInfo buff)
		{
			bool flag = buff == null;
			if (flag)
			{
				this._onFreezeBuff = false;
				this._freezeBuffInfo = null;
				bool flag2 = XEntity.ValideEntity(this._entity);
				if (flag2)
				{
					this.Attached();
				}
			}
			else
			{
				this._onFreezeBuff = true;
				this._freezeBuffInfo = buff;
				this._nameSpcSymbol.SetVisible(true);
				BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData((int)buff.buffID, (int)buff.buffLevel);
				XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
				{
					this.GetStr("", XBillboardComponent.billboardString_red + buffData.BuffName, false)
				});
				this.DrawStr(this._nameSpcSymbol);
				this._bloodBar.SetForegroundColor(XBillboardComponent.billboard_red);
			}
		}

		// Token: 0x0600D168 RID: 53608 RVA: 0x003097FB File Offset: 0x003079FB
		public void HideBillboard()
		{
			this._uiDummy.alpha = 0f;
		}

		// Token: 0x0600D169 RID: 53609 RVA: 0x00309810 File Offset: 0x00307A10
		public void AttachDummyBillboard(string name, int level, int prof)
		{
			bool flag = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.SelectChar;
			if (flag)
			{
				this._heroHeight = XSingleton<XProfessionSkillMgr>.singleton.GetSelectCharDummyHeight((uint)prof);
			}
			else
			{
				this._heroHeight = 1f;
			}
			float num = 0.003f;
			this._billboard.localScale = new Vector3(num, num, num);
			this._uiDummy.alpha = 1f;
			this._compRef = (this._billboard.GetComponent("XUIBillBoardCompRef") as IXUIBillBoardCompRef);
			this._bloodBar = this._compRef.BloodBar;
			this._indureBar = this._compRef.IndureBar;
			this._guildSpcSymbol = this._compRef.GuildSpecLabelSymbol;
			this._desiSpcSymbol = this._compRef.DesiSpecLabelSymbol;
			this._nameSpcSymbol = this._compRef.NameSpecLabelSymbol;
			this._bloodBar.SetVisible(false);
			this._indureBar.SetVisible(false);
			this._guildSpcSymbol.SetVisible(false);
			this._desiSpcSymbol.SetVisible(false);
			this._nameSpcSymbol.SetVisible(true);
			XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
			{
				this.GetStr("", string.Concat(new object[]
				{
					"Lv.",
					level,
					" ",
					name
				}), false)
			});
			this.DrawStr(this._nameSpcSymbol);
		}

		// Token: 0x0600D16A RID: 53610 RVA: 0x00309984 File Offset: 0x00307B84
		public float GetExitTitleHeight()
		{
			float num = 0f;
			bool flag = this._billboard != null;
			if (flag)
			{
				for (int i = 0; i < this._billboard.childCount; i++)
				{
					Transform child = this._billboard.GetChild(i);
					bool activeSelf = child.gameObject.activeSelf;
					if (activeSelf)
					{
						num = Mathf.Max(num, child.localPosition.y);
					}
				}
			}
			return num;
		}

		// Token: 0x0600D16B RID: 53611 RVA: 0x00309A00 File Offset: 0x00307C00
		public bool AttachChild(Transform child, bool updatePos = false, float childHeight = 60f)
		{
			bool flag = this._billboard != null;
			bool result;
			if (flag)
			{
				child.parent = this._billboard;
				child.transform.localRotation = Quaternion.identity;
				child.transform.localScale = Vector3.one;
				if (updatePos)
				{
					float exitTitleHeight = this.GetExitTitleHeight();
					child.transform.localPosition = new Vector3(0f, exitTitleHeight + childHeight, 0f);
				}
				else
				{
					child.transform.localPosition = Vector3.zero;
				}
				result = true;
			}
			else
			{
				result = false;
			}
			return result;
		}

		// Token: 0x0600D16C RID: 53612 RVA: 0x00309A98 File Offset: 0x00307C98
		public bool UnAttachChild(Transform child)
		{
			bool flag = this._billboard != null;
			if (flag)
			{
				for (int i = 0; i < this._billboard.childCount; i++)
				{
					Transform child2 = this._billboard.GetChild(i);
					bool flag2 = child2 == child;
					if (flag2)
					{
						child.parent = null;
						return true;
					}
				}
			}
			return false;
		}

		// Token: 0x0600D16D RID: 53613 RVA: 0x00309B04 File Offset: 0x00307D04
		private void UpdateDummyBillboard()
		{
			Vector3 vector = new Vector3(this._entity.EngineObject.Position.x, this._entity.EngineObject.Position.y + this._heroHeight, this._entity.EngineObject.Position.z);
			Vector3 vector2 = XSingleton<XCommon>.singleton.Horizontal(XSingleton<XScene>.singleton.GameCamera.CameraTrans.position - this._entity.EngineObject.Position);
			this._billboard.position = vector + vector2 * 0.5f;
			this._billboard.rotation = XSingleton<XScene>.singleton.GameCamera.Rotaton;
		}

		// Token: 0x0600D16E RID: 53614 RVA: 0x00309BCB File Offset: 0x00307DCB
		public void SetSelectCharStageScale()
		{
			this._billboard.localScale = this._billboard.localScale / 3f * 2f;
		}

		// Token: 0x0600D16F RID: 53615 RVA: 0x00309BFC File Offset: 0x00307DFC
		private void KeepAllDepth()
		{
			this.TextDepthMgr.Clear();
			this.SpriteDepthMgr.Clear();
			this.BoardDepthMgr.Clear();
			this.KeepDepth(this._desiSpcSymbol);
			this.KeepDepth(this._guildSpcSymbol);
			this.KeepDepth(this._nameSpcSymbol);
			bool isPlayer = this._entity.IsPlayer;
			if (isPlayer)
			{
				this.SetBillBoardDepth(true, 0f);
			}
		}

		// Token: 0x0600D170 RID: 53616 RVA: 0x00309C74 File Offset: 0x00307E74
		private void KeepDepth(IXUISpecLabelSymbol symbol)
		{
			bool flag = symbol.IsVisible();
			if (flag)
			{
				bool flag2 = symbol.Label.IsVisible();
				if (flag2)
				{
					this.TextDepthMgr.Add(symbol.Label);
				}
				bool flag3 = symbol.Board.IsVisible();
				if (flag3)
				{
					this.BoardDepthMgr.Add(symbol.Board);
				}
				for (int i = 0; i < symbol.SpriteList.Length; i++)
				{
					bool flag4 = symbol.SpriteList[i].IsVisible();
					if (flag4)
					{
						this.SpriteDepthMgr.Add(symbol.SpriteList[i]);
					}
				}
			}
		}

		// Token: 0x0600D171 RID: 53617 RVA: 0x00309D18 File Offset: 0x00307F18
		private void SetBillBoardDepth(bool isMy, float dis = 0f)
		{
			bool flag = !this._billboard.gameObject.activeInHierarchy;
			if (!flag)
			{
				int num = isMy ? 10 : (-(int)(dis * 100f));
				for (int i = 0; i < this.TextDepthMgr.Count; i++)
				{
					this.TextDepthMgr[i].spriteDepth = num;
				}
				for (int j = 0; j < this.SpriteDepthMgr.Count; j++)
				{
					bool flag2 = this.SpriteDepthMgr[j].spriteName != null;
					if (flag2)
					{
						this.SpriteDepthMgr[j].spriteDepth = num;
					}
				}
				for (int k = 0; k < this.BoardDepthMgr.Count; k++)
				{
					bool flag3 = this.BoardDepthMgr[k].spriteName != null;
					if (flag3)
					{
						this.BoardDepthMgr[k].spriteDepth = num - 1;
					}
				}
			}
		}

		// Token: 0x0600D172 RID: 53618 RVA: 0x00309E24 File Offset: 0x00308024
		private void DrawStr(IXUISpecLabelSymbol symbol)
		{
			symbol.SetInputText(XSingleton<UiUtility>.singleton.ComSpriteStr);
		}

		// Token: 0x0600D173 RID: 53619 RVA: 0x00309E38 File Offset: 0x00308038
		private string GetStr(string atlas, string sprite, bool isAnimation = false)
		{
			string result;
			if (isAnimation)
			{
				result = string.Format("{0}|{1}|1", atlas, sprite);
			}
			else
			{
				result = string.Format("{0}|{1}|0", atlas, sprite);
			}
			return result;
		}

		// Token: 0x0600D174 RID: 53620 RVA: 0x00309E6C File Offset: 0x0030806C
		private bool OnBigMeleePointChange(XEventArgs e)
		{
			XBigMeleeBattleDocument.RoleData roleData = XBigMeleeBattleDocument.Doc.userIdToRole[this._entity.ID];
			this.SetBigMeleePointInfo(roleData.point, DlgBase<BattleContiDlg, BattleContiBehaviour>.singleton.CurEnemy == this._entity.ID);
			return true;
		}

		// Token: 0x0600D175 RID: 53621 RVA: 0x00309EC0 File Offset: 0x003080C0
		private bool OnBigMeleeEnemyChange(XEventArgs e)
		{
			XBigMeleeEnemyChange xbigMeleeEnemyChange = e as XBigMeleeEnemyChange;
			XBigMeleeBattleDocument.RoleData roleData = XBigMeleeBattleDocument.Doc.userIdToRole[this._entity.ID];
			this.SetBigMeleePointInfo(roleData.point, xbigMeleeEnemyChange.isEnemy);
			return true;
		}

		// Token: 0x0600D176 RID: 53622 RVA: 0x00309F08 File Offset: 0x00308108
		private void SetBigMeleePointInfo(uint point, bool isEnemy)
		{
			bool flag = this.pointType == 1;
			if (flag)
			{
				int num = 1;
				int num2 = 1;
				int i;
				for (i = (int)point; i >= 10; i /= 10)
				{
					num++;
					num2 *= 10;
				}
				i = (int)point;
				int num3 = 0;
				string[] array;
				if (isEnemy)
				{
					array = new string[num + 2];
					array[num3++] = this.GetStr(XBillboardComponent.POINT_ATLAS, "icon_cr", false);
				}
				else
				{
					array = new string[num + 1];
				}
				array[num3++] = this.GetStr(XBillboardComponent.POINT_ATLAS, "NmFight_jf", false);
				for (int j = num3; j < num3 + num; j++)
				{
					array[j] = this.GetStr(XBillboardComponent.POINT_ATLAS, string.Format("NmFight_{0}", i / num2), false);
					i %= num2;
					num2 /= 10;
				}
				XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(array);
			}
			else if (isEnemy)
			{
				XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
				{
					this.GetStr(XBillboardComponent.POINT_ATLAS, "icon_cr", false),
					this.GetStr("", string.Format("{0}:{1}", XStringDefineProxy.GetString("POINT"), point), false)
				});
			}
			else
			{
				XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
				{
					this.GetStr("", string.Format("{0}:{1}", XStringDefineProxy.GetString("POINT"), point), false)
				});
			}
			this._guildSpcSymbol.SetVisible(true);
			this.DrawStr(this._guildSpcSymbol);
			XSingleton<UiUtility>.singleton.ComSpriteStr.Clear();
		}

		// Token: 0x04005EC0 RID: 24256
		public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("Character_Billboard");

		// Token: 0x04005EC1 RID: 24257
		public static string HPBAR_TEMPLATE = "UI/Billboard/Billboard";

		// Token: 0x04005EC2 RID: 24258
		private static readonly string BOSS_ICON_ATLAS = "common/Billboard";

		// Token: 0x04005EC3 RID: 24259
		private static readonly string BOSS_ICON_SPRITE = "BOSSicon";

		// Token: 0x04005EC4 RID: 24260
		private static readonly string ELITE_ICON_ATLAS = "common/Billboard";

		// Token: 0x04005EC5 RID: 24261
		private static readonly string ELITE_ICON_SPRITE = "BOSSicon";

		// Token: 0x04005EC6 RID: 24262
		private static readonly string GUILD_ICON_ATLAS = "common/Billboard";

		// Token: 0x04005EC7 RID: 24263
		private static readonly string DESIGNATION_ATLAS = "common/Title";

		// Token: 0x04005EC8 RID: 24264
		private static readonly string MILITARY_ATLAS = "common/Billboard";

		// Token: 0x04005EC9 RID: 24265
		private static readonly string NPCFAVOR_ICON_SPRITE = "Blessing";

		// Token: 0x04005ECA RID: 24266
		private static readonly string POINT_ATLAS = "common/Billboard";

		// Token: 0x04005ECB RID: 24267
		private Transform _billboard = null;

		// Token: 0x04005ECC RID: 24268
		private float _heroHeight = 10f;

		// Token: 0x04005ECD RID: 24269
		private float f = 1f;

		// Token: 0x04005ECE RID: 24270
		private IUIDummy _uiDummy = null;

		// Token: 0x04005ECF RID: 24271
		private static float k = 0.001f;

		// Token: 0x04005ED0 RID: 24272
		private static float[] fscale;

		// Token: 0x04005ED1 RID: 24273
		private float _heroRidingHeight = 0.5f;

		// Token: 0x04005ED2 RID: 24274
		private IXUIProgress _bloodBar = null;

		// Token: 0x04005ED3 RID: 24275
		private IXUIProgress _indureBar;

		// Token: 0x04005ED4 RID: 24276
		public IXUIBillBoardCompRef _compRef;

		// Token: 0x04005ED5 RID: 24277
		public IXUISpecLabelSymbol _desiSpcSymbol;

		// Token: 0x04005ED6 RID: 24278
		public IXUISpecLabelSymbol _guildSpcSymbol;

		// Token: 0x04005ED7 RID: 24279
		public IXUISpecLabelSymbol _nameSpcSymbol;

		// Token: 0x04005ED8 RID: 24280
		private bool InitByMaster = false;

		// Token: 0x04005ED9 RID: 24281
		private string _nameColor = "";

		// Token: 0x04005EDA RID: 24282
		private float _viewDistance = 0f;

		// Token: 0x04005EDB RID: 24283
		private bool _alwaysShow = false;

		// Token: 0x04005EDC RID: 24284
		private int _alwaysHide = 0;

		// Token: 0x04005EDD RID: 24285
		private BillboardUsage _secondbar_usage = BillboardUsage.Indure;

		// Token: 0x04005EDE RID: 24286
		private bool _bHitFlag = false;

		// Token: 0x04005EDF RID: 24287
		private uint _timer = 0U;

		// Token: 0x04005EE0 RID: 24288
		private uint _hideTimer = 0U;

		// Token: 0x04005EE1 RID: 24289
		private bool _onFreezeBuff = false;

		// Token: 0x04005EE2 RID: 24290
		private UIBuffInfo _freezeBuffInfo;

		// Token: 0x04005EE3 RID: 24291
		public static readonly Color billboard_red = new Color32(byte.MaxValue, 61, 35, byte.MaxValue);

		// Token: 0x04005EE4 RID: 24292
		public static readonly Color billboard_yellow = new Color32(byte.MaxValue, byte.MaxValue, 0, byte.MaxValue);

		// Token: 0x04005EE5 RID: 24293
		public static readonly Color billboard_gold = new Color32(byte.MaxValue, 153, 0, byte.MaxValue);

		// Token: 0x04005EE6 RID: 24294
		public static readonly Color billboard_sgreen = new Color32(123, byte.MaxValue, 128, byte.MaxValue);

		// Token: 0x04005EE7 RID: 24295
		public static readonly Color billboard_green = new Color32(92, byte.MaxValue, 0, byte.MaxValue);

		// Token: 0x04005EE8 RID: 24296
		public static readonly Color billboard_blue = new Color32(0, 189, byte.MaxValue, byte.MaxValue);

		// Token: 0x04005EE9 RID: 24297
		public static readonly Color billboard_white = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);

		// Token: 0x04005EEA RID: 24298
		public static readonly Color billboard_ally_hp = new Color32(byte.MaxValue, 236, 0, byte.MaxValue);

		// Token: 0x04005EEB RID: 24299
		public static readonly Color billboard_favor = new Color32(byte.MaxValue, 145, 69, byte.MaxValue);

		// Token: 0x04005EEC RID: 24300
		public static readonly Color nullColor = new Color32(0, 0, 0, 0);

		// Token: 0x04005EED RID: 24301
		public static readonly string billboardString_red = "[ff3d23]";

		// Token: 0x04005EEE RID: 24302
		public static readonly string billboardString_syellow = "[ffeb04]";

		// Token: 0x04005EEF RID: 24303
		public static readonly string billboardString_blue = "[00bdff]";

		// Token: 0x04005EF0 RID: 24304
		public static readonly string billboardString_gold = "[ff9900]";

		// Token: 0x04005EF1 RID: 24305
		public static readonly string billboardString_white = "[ffffff]";

		// Token: 0x04005EF2 RID: 24306
		public bool _bHpbarVisible = false;

		// Token: 0x04005EF3 RID: 24307
		public bool _bIndurebarVisible = false;

		// Token: 0x04005EF4 RID: 24308
		private XTimerMgr.ElapsedEventHandler _resetOnHitCb = null;

		// Token: 0x04005EF5 RID: 24309
		private bool _inited = false;

		// Token: 0x04005EF6 RID: 24310
		private bool _active = false;

		// Token: 0x04005EF7 RID: 24311
		private List<IXUILabel> TextDepthMgr = new List<IXUILabel>();

		// Token: 0x04005EF8 RID: 24312
		private List<IXUISprite> SpriteDepthMgr = new List<IXUISprite>();

		// Token: 0x04005EF9 RID: 24313
		private List<IXUISprite> BoardDepthMgr = new List<IXUISprite>();

		// Token: 0x04005EFA RID: 24314
		private int pointType = int.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("BigMeleePointType"));
	}
}
